<?php

namespace App\Admin\Controllers\Business;

use App\Admin\Models\Goods;
use App\Http\Controllers\Controller;
use Encore\Admin\Grid;
use Encore\Admin\Layout\Content;

class GoodsController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->title('商品')
            ->description('商品列表')
            ->row($this->grid());
    }

    public function grid()
    {
        $grid = new Grid(new Goods());

        $grid->column('id', __('ID'));
        $grid->column('name', '名称');
        $grid->column('price', "价格");
        $grid->column('amount', "库存");
        $grid->column('limit_amount', "每次限购");
        $grid->column('start_time', '开售时间');
        $grid->column('created_at', '注册时间');
        $grid->column('updated_at', '更新时间');
        return $grid;
    }
}
